<template>
	<view>
		<view class="calendar">
			<wu-calendar :insert="true" type="week" :fold="true" startWeek="mon" color="#FF8535"
				@change="calendarChange"></wu-calendar>
		</view>

		<view class="lesson">
			<view class="title">
				<view class="ico_org"></view>
				<view class="time">
					15:45-17:45
				</view>
				<view class="teacher">
					<image class="ph" src="../../static/ico_head.png" mode="aspectFill"></image>
					<view class="text">上课老师</view>
				</view>
			</view>
			<view class="info">
				<view class="text">
					08.10喜悦大教室
				</view>
				<view class="text">
					喜悦大教室2班
				</view>
				<view class="text">
					无作业标题
				</view>
				<view class="text">
					无作业内容
				</view>
				<view class="weekly">
					每周循环
				</view>

			</view>
			<view class="state org" @click="gotoWork">
				布置作业
			</view>
		</view>

		<view class="lesson">
			<view class="title">
				<view class="ico_org"></view>
				<view class="time">
					15:45-17:45
				</view>
				<view class="teacher">
					<image class="ph" src="../../static/ico_head.png" mode="aspectFill"></image>
					<view class="text">上课老师</view>
				</view>
			</view>
			<view class="info">
				<view class="text">
					08.10喜悦大教室
				</view>
				<view class="text">
					喜悦大教室2班
				</view>
				<view class="text">
					无作业标题
				</view>
				<view class="text">
					无作业内容
				</view>
				<view class="weekly">
					每周循环
				</view>
				<image class="ico_call" src="../../static/ico_4.png" mode="widthFix"></image>
			</view>
			<view class="state">
				布置作业
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		onLoad() {

		},
		onShow() {

		},
		methods: {
			calendarChange(e) {
				console.log(e);
			},
			gotoWork() {
				uni.navigateTo({
					url: '/pages/homework/homework'
				});
			},
			onDayClick(data) {
				let choose = data.date //用户点中的数据
				if (this.actDay.includes(choose)) { //如果用户点击的日期已经存在
					// 移除元素下标
					const index = this.actDay.indexOf(choose);
					//删除用户点击的日期
					this.actDay.splice(index, 1)
				} else if (this.chooseDay.includes(choose)) { //判断是否已经被投标
					uni.showToast({
						title: "这个日期已经被投标了",
						icon: "none"
					})
				} else {
					//添加用户点击的日期
					this.actDay.push(choose)
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.calendar {
		padding-bottom: 10rpx;
		background: #fff;
	}

	.ico_calendar {
		background: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		height: 60rpx;
	}

	.lesson {
		margin: 20rpx 32rpx 0;
		background: #fff;
		border-radius: 8rpx;
		color: #3D3D3D;

		.state {
			height: 80rpx;
			text-align: center;
			line-height: 80rpx;
			border-top: 1px solid rgba(230, 229, 231, 0.8);
			font-size: 28rpx;
			font-weight: 500;
			color: rgba(61, 61, 61, 0.5);

			&.org {
				color: #FF8535;
			}
		}

		.info {
			padding: 10rpx 140rpx 10rpx 75rpx;
			position: relative;

			.ico_call {
				position: absolute;
				right: 0;
				bottom: -20rpx;
				width: 220rpx;
			}

			.text {
				padding: 8rpx 0;
				font-size: 24rpx;
				font-weight: normal;
				line-height: 38rpx;
			}

			.weekly {
				position: absolute;
				top: 20rpx;
				right: 40rpx;
				font-size: 24rpx;
				line-height: 34rpx;
			}
		}

		.title {
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 90rpx;
			padding: 0 40rpx;
			border-bottom: 1px solid rgba(230, 229, 231, 0.8);

			.ico_org {
				flex-shrink: 0;
				width: 18rpx;
				height: 18rpx;
				background: #FF8535;
				border-radius: 50%;
				margin-right: 15rpx;
			}

			.time {
				width: 100%;
				font-size: 36rpx;
				font-weight: 500;
				line-height: 50rpx;
			}

			.teacher {
				flex-shrink: 0;
				display: flex;
				align-items: center;

				.ph {
					width: 52rpx;
					height: 52rpx;
					flex-shrink: 0;
					margin-right: 10rpx;
				}

				.text {
					font-size: 24rpx;
					line-height: 34rpx;
				}
			}
		}

		&.hover {
			color: #aaa;

			.ph {
				opacity: 0.7;
			}

			.ico_org {
				background: #D8D8D8;
			}

			.state {
				color: #aaa;
			}
		}
	}

	.call_day {
		background: #fff;
		padding: 20rpx 40rpx;

		.week {
			display: flex;
			align-items: center;
			justify-content: space-between;
			text-align: center;

			.item {
				padding-top: 15rpx;

				.name {
					font-size: 28rpx;
					font-weight: 500;
					line-height: 34px;
					color: #3D3D3D;
					opacity: 0.7;
				}

				.num {
					width: 60rpx;
					height: 60rpx;
					border-radius: 50%;
					font-size: 28rpx;
					font-weight: 500;
					line-height: 60rpx;
					color: #3D3D3D;
				}

				&.hover .num {
					color: #fff;
					background: #FF8535;
				}
			}
		}

		.title {
			display: flex;
			align-items: center;
			justify-content: space-between;
			line-height: 38rpx;
			font-size: 28rpx;
			font-weight: 500;

			.years {
				color: #3D3D3D;
			}

			.today {
				color: #FF8535;
			}
		}
	}
</style>